package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.LeftBean;
import com.lwj.liwanjia.impl.LeftView;
import com.lwj.liwanjia.model.LeftModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/11/1.
 */

public class LeftPresenter {
    private LeftModel leftModel;
    private LeftView leftView;

    public LeftPresenter(LeftView leftView) {
        this.leftView = leftView;
        leftModel = new LeftModel();
    }

    public void getLeftType(String token, int id) {
        if (leftView != null) {
            leftModel.getLeftType(token, id, new Subscriber<LeftBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    leftView.showError((Exception) e);
                }

                @Override
                public void onNext(LeftBean leftBean) {
                    leftView.getLeftType(leftBean);
                }
            });
        }
    }
}
